<template>
  <div>
    <div class="other-info-box">
      <div class="header-title">其他信息</div>
      <div class="form-info">
        <div class="item date">
          <span class="word">经办日期：</span>
          <a-date-picker
            @change="dateChange"
            style="width: 230px;"
            v-model="todayDate"
            :disabled-date="disabledDate"
          />
          <!--   -->
        </div>
        <div class="item" v-if="isShow">
          <span class="word">业绩归属人：</span>
          <a-select placeholder="请选择业绩归属人" style="width: 230px;" allowClear v-model="user_id" mode="multiple">
            <a-select-option v-for="(item,index) in userList" :key="index" :value="item.id">{{item.name}}</a-select-option>
          </a-select>
        </div>
        <div class="item remarks">
          <span class="word">备注：</span>
          <a-input type="textarea" style="width: 651px;height: 80px;" placeholder="选填" v-model="remarks"/>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import moment from 'moment'
import {accountList} from '@/api/account'
export default {
  data() {
    return {
      todayDate: moment(),
      isShow: true,
      userList:[],
      remarks:undefined,
      user_id:undefined
    }
  },
  created() {
    this.updateRoute()
    this.getUser()
  },
  methods: {
    //业绩归属人
    getUser(){
      accountList({school_id:this.$store.state.user.school,pageSize:9999}).then(res=>{
          this.userList=res.data
      }).catch(err=>{
        this.$message.error(err.data.message||'业绩归属人获取失败,请重试')
      })
    },
    updateRoute() {
      if (
        this.$route.path == '/finance/orderExpand/returnCourse' ||
        this.$route.path == '/finance/orderExpand/returnItem' ||
        this.$route.path == '/finance/orderExpand/returnCost'
      ) {
        this.isShow = false
      } else {
        this.isShow = true
      }
    },
    dateChange(date, dateString) {
      let a = moment(date).format('YYYY-MM-DD')
    },
    disabledDate(current) {
      return current && current > moment().endOf('day')
    }
  }
}
</script>

<style scoped lang="less">
.other-info-box {
  padding: 0 16px 16px;
  .header-title {
    font-size: 16px;
    color: #333;
    line-height: 48px;
    font-weight: 500;
    border-bottom: 1px solid #e8e8e8;
  }
  .form-info {
    padding: 16px 0 0 37px;
    .date {
      margin-right: 108px;
    }
    .item {
      display: inline-block;
      .word {
        float: left;
        line-height: 32px;
        text-align: right;
        color: #666;
        font-size: 14px;
      }
    }
    .remarks {
      display: block;
      margin-top: 16px;
      .word {
        width: 70px;
      }
    }
  }
}
</style>